//
//  HELAppManager.m
//  HandheldELearn
//
//  Created by wsj2015 on 16/7/13.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "HELAppManager.h"
static HELAppManager *appManager;
@implementation HELAppManager


+ (instancetype)sharedAppManger{
    if (!appManager) {
        appManager = [[HELAppManager alloc] init];
    }
    return appManager;
}

+ (HELUserInfoM *)userInfo {

   NSDictionary *userInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"userInfo"];
    HELUserInfoM *userModel = [HELUserInfoM mj_objectWithKeyValues:userInfo];
    return userModel;
}

+ (void)saveUseInfo:(NSDictionary *)userInfo {
    //存储用户信息
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    if ([userDefaults objectForKey:@"login"]) {
        [userDefaults setValue:userInfo forKey:@"userInfo"];
    }else {
        [userDefaults setObject:userInfo forKey:@"userInfo"];
        [userDefaults setBool:YES forKey:@"login"];
    }
    [userDefaults synchronize];
}


@end
